﻿#region File Info Header
/*________________________________________________________________________________________

  Copyright (C) 2011 Jason Zhang, eagleboost@msn.com

  * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
  * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.

________________________________________________________________________________________*/
#endregion File Info Header

namespace EagleBoost.Wpf.Presentation.Extensions
{
  using System.Windows.Input;

  /// <summary>
  /// Extension methods for InputBinding
  /// </summary>
  public static class InputBindingExtension
  {
    /// <summary>
    /// Register CommandBinding and InputBinding
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="input"></param>
    /// <param name="handler"></param>
    public static void Register<T>(this InputBinding input, ExecutedRoutedEventHandler handler)
    {
      CommandManager.RegisterClassCommandBinding(typeof(T), new CommandBinding(input.Command, handler));
      CommandManager.RegisterClassInputBinding(typeof(T), new InputBinding(input.Command, input.Gesture));
    }
  }
}
